home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
pcr
/
pcr4_4.lha
/
DIST
/
makefile.common
< prev
next >
Wrap
Makefile
|
1992-04-16
|
5KB
|
220 lines
#
# PCR common lower-level makefile
#
# Demers, December 1, 1989 4:14:56 pm PST
# Alan Ishigo, January 9, 1989 1:05:51 pm PST
#
#
# The following variables are defined in makefile.config
# (This implies they are inherited from above, since makefile.config
# is build automatically)
#
# COMPONENT = name of this xr component
# (= name of this subdirectory, unless checked out)
# CONFIG = name of configuration
# MACHINE = -machine_name, e.g. -sparc
# (used to construct destination directory names)
# STD_INCLUDES = where to get include files
# (e.g. -IINCLUDE -I../INCLUDE)
# CONFIG_CFLAGS = configuration-specific flags for cc
# (these are folded into CFLAGS below).
# CONFIG_AFLAGS = configuration-specific flags for as
# (these are folded into AFLAGS below).
# VERSION = version_bounce, without quotes; e.g. 1_5
#
CONFIG_DIR = ${CONFIG}${MACHINE}
VERSION_DOT_O = ${COMPONENT}Version.o
VERSION_DOT_C = ${COMPONENT}Version.c
VERSION_STRING_NAME = XR_${COMPONENT}Version
STD_INCLUDES = -IINCLUDE -I../INCLUDE
# The following may fail on non-Sun makes, sigh ...
CFLAGS += ${STD_INCLUDES} ${CONFIG_CFLAGS} ${MACHINE}
AFLAGS = ${STD_INCLUDES} ${CONFIG_AFLAGS} ${MACHINE}
# The following must correspond to ${UTILITIES_DIR}/${CPDIFF} in makefile
CPDIFF = ../../UTILITIES/copyifdifferent
#
# The following variables should be defined in the local makefile (i.e.
# the makefile that #include's this one). They can be empty:
#
# INCLUDE = header files associated with this component
# BIN = public commands (to be put into ../BIN/$CONFIG_DIR)
# OBJ = semi-public .o files (to be put into ../LIB/$CONFIG_DIR/xr.a)
# LIBA = public library objects (to be put into ../LIB/$CONFIG_DIR/libxr.a)
# LIB = public objects (to be put into ../LIB/$CONFIG_DIR/)
# MAN = manual entries
# MAKE_DEPEND_SRC = sources to be considered by "make depend"
# CLEANUPFILES = other files to remove in a make clean
#
#
# The following target appears first as a default
#
notarget: check_machine
#
# The following targets will be invoked from above with MAKEPUBLIC=TRUE
#
obj: ${OBJ}
-mkdir ../OBJtemp
if [ "x${OBJ}" != x ]; then \
for obj in ${OBJ} END; do \
if [ $$obj != END ]; then \
ln $$obj ../OBJtemp/$$obj; \
fi; \
done ; \
echo " ${VERSION_STRING_NAME}[]," \
>> ../OBJtemp/version_string_names ; \
echo " &${VERSION_STRING_NAME}[0]," \
>> ../OBJtemp/version_string_addresses ; \
fi
lib: ${LIB}
-mkdir ../LIB/${CONFIG_DIR}
for file in ${LIB} END; do \
if [ $$file != END ]; then \
cp -p $$file ../LIB/${CONFIG_DIR}; \
fi; \
done
liba: ${LIBA}
-mkdir ../LIBAtemp
for file in ${LIBA} END; do \
if [ $$file != END ]; then \
ln $$file ../LIBAtemp/$$file; \
fi; \
done
bin: ${BIN}
-mkdir ../BIN/${CONFIG_DIR}
for file in ${BIN} END; do \
if [ $$file != END ]; then \
mv $$file ../BIN/${CONFIG_DIR}; \
fi; \
done
src:
-mkdir ../SRC
for file in `(ls *.c *.s 2> /dev/null)` END; do \
if [ $$file != END ]; then \
rm -f ../SRC/$$file; ln $$file ../SRC/$$file; \
fi; \
done
include:
-mkdir ../INCLUDE/xr
for file in ${INCLUDE} END; do \
if [ $$file != END ]; then \
${CPDIFF} -p INCLUDE/xr/$$file ../INCLUDE/xr/$$file; \
fi; \
done
man:
-mkdir ${MAN_DIR}
for file in ${MAN} END; do \
if [ $$file != END ]; then \
${CPDIFF} -p $$file ${MAN_DIR}; \
fi; \
done
clean:
rm -f ${LIB} ${LIBA} ${OBJ} ${BIN} ${CLEANUPFILES} *.o *.a *.bak *~ core XrDBXInner
#
# Automatic version numbering
#
${VERSION_DOT_O}: ${VERSION_DOT_C}
${CC} -c ${CFLAGS} ${VERSION_DOT_C}
rm -f ${VERSION_DOT_C}
${VERSION_DOT_C}:
echo "char ${VERSION_STRING_NAME}[] = \"${VERSION} (${CONFIG})" \
`date` "\";" > ${VERSION_DOT_C}
#
# checkout / checkin
#
# These fail if not interleaved properly.
#
# Checkin can be done from either the old or new directory.
#
checkout:
mkdir ../${COMPONENT}.co
tar cf - . | (cd ../${COMPONENT}.co; tar xf -);
checkin:
mv ../${COMPONENT} ../${COMPONENT}.SAV
mkdir ../${COMPONENT}
(cd ../${COMPONENT}.co; tar cf - . ) | (cd ../${COMPONENT}; tar xf -)
rm -rf ../${COMPONENT}.SAV
#
# Dependency construction
#
# NOTE: the makefile must include "# DO NOT DELETE THIS LINE" after the
# last target. "make depend" will replace everything following that line
# by a newly-constructed list of dependencies.
#
depend: makefile.config ${MAKE_DEPEND_SRC}
if [ "x${MAKE_DEPEND_SRC}" != x ]; then \
rm -f makedep eddep ; \
${CC} -M ${CFLAGS} ${MAKE_DEPEND_SRC} \
| sed -e '/:$$/d' > makedep ; \
echo '/^# DO NOT DELETE THIS LINE/+1,$$d' >eddep ; \
echo '$$r makedep' >>eddep ; \
echo 'w' >>eddep ; \
cp makefile makefile.bak ; \
ex - makefile < eddep ; \
fi
rm -f eddep makedep
touch depend
#
# Internal consistency check for machine types
#
# (Does this work on non-Sun?)
#
check_machine:
@if [ ${MACHINE} != ${TARGET_MACH} ]; then \
echo "Compiling on wrong machine type (" ${TARGET_MACH} ")"; \
exit 1; \
fi
#
# The following is intended to force complete recompilation when makefile.config
# changes.
#
# If anything in ${BIN}, ${LIB}, ${LIBA} or ${OBJ} is built with ld,
# (and this is almost certainly the case)
#
# --> YOU WILL NEED TO ADD MORE DEPENDENCIES TO MAKE THIS WORK RIGHT <--.
#
${BIN} ${LIB} ${LIBA} ${OBJ}: makefile.config